<template>
<div>
    <el-form :model="form">
        <el-form-item label="姓名">
            <el-input v-model="form.name" />
        </el-form-item>
        <el-form-item label="年龄">
            <el-input v-model="form.age" type="number" />
        </el-form-item>
        <el-form-item label="性别">
            <el-select v-model="form.sex" placeholder="请选择性别">
                <el-option v-for="item in sexList" :label="item.label" :value="item.value" />
            </el-select>
        </el-form-item>
        <el-form-item label="语文">
            <el-input v-model.number="form.score.yw" type="number" />
        </el-form-item>
        <el-form-item label="数学">
            <el-input v-model.number="form.score.sx" type="number" />
        </el-form-item>
        <el-form-item label="英语">
            <el-input v-model.number="form.score.yy" type="number" />
        </el-form-item>
        <el-form-item>
            <el-button @click="form = null">重置</el-button>
            <el-button type="primary" @click="submit">提交</el-button>
        </el-form-item>
    </el-form>
</div>
</template>
<script>
import {ref} from 'vue';

export default {
    name: 'Report',
    emits:['addStu'],
    setup(props,cxt) {
        const sexList = [{ label: '男', value: '女', }, { label: '女', value: '女', },];
        const form = ref({ name: '', age: 0, sex: '', score: { yw: 0, sx: 0, yy: 0 }, avatar: '', });
        const submit=function(){
            cxt.emit('addStu',form.value)
        }
        const report = {};
        form.value = { name: '', age: 0, sex: '', score: { yw: 0, sx: 0, yy: 0 }, avatar: ''  };
        return {
            sexList,
            form,
            submit

        }
    }
}

</script>
<style></style>